import pymysql

host = 'localhost'
user = 'root'
password = '123456'
database = 'finance'


def update(sql,param):
        conn = pymysql.connect(host=host, user=user, password=password, database=database)
        cursor = conn.cursor()
        cursor.execute(sql,param)
        conn.commit()
        cursor.close()
        conn.close()

def select(sql,param):
        con = pymysql.connect(host=host, user=user, password=password, database=database)
        cursor = con.cursor()
        cursor.execute(sql, param)
        data = cursor.fetchall()
        con.commit()
        cursor.close()
        con.close()
        return data